/*
Copyright (c) 2019 Alibaba Group Holding Limited

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

*/
//*******************************
//         ASCON_HASH 
//*******************************
#ifndef __ASCON_HASH_H_
#define __ASCON_HASH_H_

#include "my_sys.h"

#define ASCON_HASH_RX_BASE   0xf0100000
#define ASCON_HASH_REG_BASE  0xf0100400
#define ASCON_HASH_TX_BASE   0xf0100800
#define ASCON_HASH_REG       ((Ascon_Hash_TypeDef *) ASCON_HASH_REG_BASE)

typedef struct
{
 u32 MBN;//msg_block_num
 u32 MA; //msg_addr
 u32 HCS;//hash_ctrl_sta
 u32 HCE;//hash_ctrl_en
 u32 HCM;//hash_ctrl_mode
 u32 HHA;//hash_h_addr
}Ascon_Hash_TypeDef;

typedef struct
{
 u32 msg_block_num;//msg_block_num 待提取摘要的数据数量,单位byte
 u32 msg_addr;//msg_addr 待提取摘要信息存储在rx buf的地址
 u32 hash_ctrl_mode;//hash_ctrl_mode 摘要引擎的工作模式
 u32 hash_h_addr;//hash_h_addr 生成的摘要存放在tx buf的地址
 u32* msg_data;  //待提取摘要的数据指针
 u32* hash_data; //生成的摘要指针
 FunctionalState hash_ctrl_en;//hash_ctrl_en 使能提取摘要算法
}Ascon_Hash_InitTypeDef;

extern void Ascon_Hash_Init(Ascon_Hash_InitTypeDef* ascon_hash_initstruct);
extern void Ascon_Hash_Send_Msg(Ascon_Hash_InitTypeDef* ascon_hash_initstruct);
extern void Start_Ascon_Hash(Ascon_Hash_InitTypeDef* ascon_hash_initstruct);
extern u8 Whether_Ascon_Hash(void);
extern void Get_Ascon_Hash(Ascon_Hash_InitTypeDef* ascon_hash_initstruct);

#endif